<template>
    <div class="container">
      <van-nav-bar
        title="设置"
        left-text="返回"
        left-arrow
        @click-left="onClickLeft"
        />
        <div class="set_btn">
         <div style="margin-left:20px; color:#404247;font-size:14px">待支付订单流转</div>
     
         <el-switch
          v-model="auto_circulation"
           @change="zidongliuzhuan()"
           active-color="rgb(0, 90, 255);"
          inactive-color="rgb(246, 248, 251);"
          :active-value="1"
          :inactive-value="0"
          style="margin-right:10px"
          ></el-switch>

        </div>
    </div>
</template>
<script>
export default {
 name:'setting',
 data(){
    return{
        auto_circulation: 0, //自动流转
    }
 },
   mounted(){
    this.getzidongliuzhuan();
   },
    methods:{
    onClickLeft(){
        this.$router.go(-1)
    },
     getzidongliuzhuan: function() {
      axios.get("/own/page/system/get").then(response => {
        if (response.data.msg.code == 0) {
          this.auto_circulation = response.data.data.auto_circulation;
        } else {
          this.$message.error(response.data.msg.info);
        }
      });
    },
    zidongliuzhuan: function() {
      axios
        .post("/own/page/system/config", {
          auto_circulation: this.auto_circulation
        })
        .then(response => {
          if (response.data.msg.code == 0) {
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          } else {
            this.$message.error(response.data.msg.info);
          }
        });
    },
}
}


</script>
<style scoped lang="less">
.container{
    width: 100vw;
    height: 100vh;
    background: #FFFFFF;
}
/deep/ .van-nav-bar .van-icon{
    color: black;
}
/deep/ .van-nav-bar__text{
 color: black; 
}
.set_btn{
    display: flex;
    justify-content: space-between;
    width: 100%;
    height: 60px;
    border-bottom: 1px solid #E3E8F1;
    align-items: center;
}
</style>